import { createRouter, createWebHistory } from 'vue-router'
// 二
export const menu_router=[
   {
      path: '/',
      name: 'home',
      meta:{
        title:'首页',
      },
      component: () => import('../views/home/indexView.vue')
    },
    {
      path:'/manage',
      name:'manage',
      meta:{
        title:'物业管理'
      },
      // 三级路由
      children:[
        {
          path:'/manage/list',
          meta:{
            title:'列表'
          },
          component:()=>import('../views/list/indexView.vue')
        },
         {
          path:'/manage/room',
          meta:{
            title:'房屋'
          },
          component:()=>import('../views/room/indexView.vue')
        },

      ]
    }
]

const router = createRouter({
  // 一级
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: ()=>import('../views/layout/indexView.vue'),
      children:menu_router

    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/indexView.vue')
    },
        {
      path: '/oauth/lzd',
      name: 'oauth',
      component: () => import('../views/oauth/indexView.vue')
    },
    {
      path: '/404',
      name: '404',
      component: () => import('../views/404/indexView.vue')
    },
    {
      path:'/:pathMatch(.*)*',
      redirect:'/404'
    }
  ]
})

export default router
